/**
 */
package de.thwildau.tm.moses.asn1.asn1.impl;

import de.thwildau.tm.moses.asn1.asn1.Asn1Package;
import de.thwildau.tm.moses.asn1.asn1.Assignment;
import de.thwildau.tm.moses.asn1.asn1.Imports;

import java.util.Collection;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

import org.eclipse.emf.ecore.util.EObjectResolvingEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Imports</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link de.thwildau.tm.moses.asn1.asn1.impl.ImportsImpl#getSymbolsImported <em>Symbols Imported</em>}</li>
 *   <li>{@link de.thwildau.tm.moses.asn1.asn1.impl.ImportsImpl#getModulereference <em>Modulereference</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ImportsImpl extends MinimalEObjectImpl.Container implements Imports
{
  /**
   * The cached value of the '{@link #getSymbolsImported() <em>Symbols Imported</em>}' reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getSymbolsImported()
   * @generated
   * @ordered
   */
  protected EList<Assignment> symbolsImported;

  /**
   * The default value of the '{@link #getModulereference() <em>Modulereference</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getModulereference()
   * @generated
   * @ordered
   */
  protected static final String MODULEREFERENCE_EDEFAULT = null;

  /**
   * The cached value of the '{@link #getModulereference() <em>Modulereference</em>}' attribute.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getModulereference()
   * @generated
   * @ordered
   */
  protected String modulereference = MODULEREFERENCE_EDEFAULT;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected ImportsImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return Asn1Package.Literals.IMPORTS;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<Assignment> getSymbolsImported()
  {
    if (symbolsImported == null)
    {
      symbolsImported = new EObjectResolvingEList<Assignment>(Assignment.class, this, Asn1Package.IMPORTS__SYMBOLS_IMPORTED);
    }
    return symbolsImported;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public String getModulereference()
  {
    return modulereference;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setModulereference(String newModulereference)
  {
    String oldModulereference = modulereference;
    modulereference = newModulereference;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, Asn1Package.IMPORTS__MODULEREFERENCE, oldModulereference, modulereference));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case Asn1Package.IMPORTS__SYMBOLS_IMPORTED:
        return getSymbolsImported();
      case Asn1Package.IMPORTS__MODULEREFERENCE:
        return getModulereference();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @SuppressWarnings("unchecked")
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case Asn1Package.IMPORTS__SYMBOLS_IMPORTED:
        getSymbolsImported().clear();
        getSymbolsImported().addAll((Collection<? extends Assignment>)newValue);
        return;
      case Asn1Package.IMPORTS__MODULEREFERENCE:
        setModulereference((String)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case Asn1Package.IMPORTS__SYMBOLS_IMPORTED:
        getSymbolsImported().clear();
        return;
      case Asn1Package.IMPORTS__MODULEREFERENCE:
        setModulereference(MODULEREFERENCE_EDEFAULT);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case Asn1Package.IMPORTS__SYMBOLS_IMPORTED:
        return symbolsImported != null && !symbolsImported.isEmpty();
      case Asn1Package.IMPORTS__MODULEREFERENCE:
        return MODULEREFERENCE_EDEFAULT == null ? modulereference != null : !MODULEREFERENCE_EDEFAULT.equals(modulereference);
    }
    return super.eIsSet(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public String toString()
  {
    if (eIsProxy()) return super.toString();

    StringBuffer result = new StringBuffer(super.toString());
    result.append(" (modulereference: ");
    result.append(modulereference);
    result.append(')');
    return result.toString();
  }

} //ImportsImpl
